import { StationParkType } from "@/pages/station/stationList/services"
import request from "@/utils/request"

export enum PowerStatus {
  已安 = 1,
  未安 = 2,
}
export enum LockStatus {
  已安 = 1,
  未安 = 2,
}
export enum ZhaoMuStatus {
  招募中 = 1,
  已合作 = 2,
  已删除 = 11,
}
export enum ZhaoMuGround {
  居民区 = 1,
  公共机构 = 2,
  企事业单位 = 3,
  写字楼 = 4,
  工业园区 = 5,
  其他 = 6,
}

export interface QueryZhaoMuListParams extends PaginationParams {
  cityId?: string
  parkPayType?: StationParkType
  status?: ZhaoMuStatus
  keyword?: string
  lockStatus?: LockStatus
}

export interface ZhaoMu {
  id: number
  stationName: string
  createTime: string
  updateTime: string
  longitude: number
  latitude: number
  cityId: string
  address: string
  /** 小区名 */
  houseName: string
  /** 电表状态 */
  powerStatus: PowerStatus
  /** 面积 */
  placeArea: number
  /** 直流数量 */
  stubOneNum: number
  /** 交流数量 */
  stubTwoNum: number
  /** 地锁状态 */
  lockStatus: LockStatus
  /** 充电车位数量 */
  chargeNum: number
  /** 服务时间 */
  serviceInfo: string
  /** 投资金额 */
  infoMoney: number
  status: ZhaoMuStatus
  notice: string
  createAccount: string
  updateAccount: string
  parkType: StationParkType
  parkInfo: string
  imgs: string
  /** 场地类型 */
  ground: ZhaoMuGround
  /** 介绍（富文本） */
  introInfo: string
  /** 联系方式 */
  linkInfo: string
  /** 分成比例 */
  scale: number
  /** 合作期限 */
  hzqx: number
}

export async function queryZhaoMuList(params: QueryZhaoMuListParams) {
  return request<ZhaoMu[]>('/app/manager/salStation/list', {
    data: params,
  })
}

export async function saveZhaoMu(params: Partial<ZhaoMu>) {
  return request('/app/manager/salStation/addOrUpdate', {
    data: params,
  })
}

export async function getZhaoMuInfo(params: {stationId: number}) {
  return request<ZhaoMu>('/app/manager/salStation/detail', {
    data: params,
  })
}

export async function delZhaoMu(params: {stationId: number}) {
  return request('/app/manager/salStation/del', {
    data: params,
  })
}
